import '../../../../common/values/svg_image.dart';
import '../../smart_home_info/model/device_dynamic_model.dart';

class HomePageCommonUtils {
  //根据设备类型对应首页底部栏图标
  static String getRightIconName(String type) {
    String deviceIconName = 'assets/svgs/homepage/c_ic_aircon.svg';
    switch (type) {
      case 'light':
        deviceIconName = 'assets/svgs/homepage/dynamic_ic_lighting.svg';
        break;
      case 'switch':
        deviceIconName = 'assets/svgs/homepage/dynamic_ic_switch.svg';
        break;
      case 'socket':
        deviceIconName = 'assets/svgs/homepage/dynamic_ic_socket.svg';
        break;
      case 'curtain':
        deviceIconName = 'assets/svgs/homepage/dynamic_ic_curtain.svg';
        break;
      case 'thermostat':
        deviceIconName = SVGImage.cIcAirconSvg;
        break;
      case 'security':
        deviceIconName = 'assets/svgs/homepage/dynamic_ic_dnw.svg';
        break;
      case 'motion':
        deviceIconName = 'assets/svgs/homepage/dynamic_ic_motion.svg';
        break;
      case 'offline':
        deviceIconName = 'assets/svgs/homepage/dynamic_ic_abnormal.svg';
        break;
      case 'low_battery':
        deviceIconName = SVGImage.dynamicIcLowbatterySvg;
        break;
    }
    return deviceIconName;
  }

//根据设备类型对应首页动态类型
  static String getRightDeviceName(String type) {
    String deviceName = '';
    switch (type) {
      case 'light':
        deviceName = '照明';
        break;
      case 'switch':
        deviceName = '开关';
        break;
      case 'socket':
        deviceName = '插座';
        break;
      case 'thermostat':
        deviceName = '恒温';
        break;
      case 'curtain':
        deviceName = '窗帘';
        break;
      case 'motion':
        deviceName = '人体';
        break;
      case 'security':
        deviceName = '安防';
        break;
      case 'offline':
        deviceName = '异常';
        break;
      case 'low_battery':
        deviceName = '低电量';
        break;
    }
    return deviceName;
  }

//根据设备类型对应首页动态类型描述
  static String getRightDeviceInfo(DeviceDynamicModelData model) {
    String deviceName = '';
    String count = '0';
    if (model.devices!.isNotEmpty) {
      count = model.devices!.length.toString();
    }
    switch (model.type) {
      case 'light':
        deviceName = '$count盏开着';
        break;
      case 'switch':
        deviceName = '$count个开着';
        break;
      case 'socket':
        deviceName = '$count个开着';
        break;
      case 'thermostat':
        deviceName = '$count个工作中';
        break;
      case 'curtain':
        deviceName = '$count个开着';
        break;
      case 'motion':
        deviceName = '$count个活动';
        break;
      case 'security':
        deviceName = '$count个开着';
        break;
      case 'offline':
        deviceName = '$count个不可用';
        break;
      case 'low_battery':
        deviceName = '$count个低电量';
        break;
    }
    return deviceName;
  }
}
